/**
 * 
 */
package com.yuyi.dao;

import java.util.List;
import java.util.Set;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import com.yuyi.model.SysPermission;
import com.yuyi.model.SysRole;
import com.yuyi.model.UserInfo;

/**
 * @author mcb 
 *
 * 2018年8月20日 下午4:13:22 
 */
@Mapper
public interface UserInfoDAO {
	
	@Select("select * from user_info where username=#{username}")
	UserInfo findByUsername(String username);
	
	@Select("select * from sys_role where id in (select role_id from sys_user_role where uid=#{uid})")
	List<SysRole> getListRole(int uid);
	
	@Select("select * from sys_permission where id in (select permission_id from sys_role_permission where role_id=#{roleId})")
	List<SysPermission>getListPermission(int roleId);
	@Insert("insert into user_info (name,password,salt,state,username) values (#{name},#{password},#{salt},#{state},#{username})")
	int insertUserInfoLogin(UserInfo userinfo);
	
	
}
